package com.ngovanhau.justsort.util;

public class UtilFormat {

	public static String fillStringZero(int number, int length) {
		String s = "0000000000000000";
		String str = Integer.toString(number);
		return s.substring(0, length - str.length()) + str;
	}

	public static String formatName(String str, int length) {
		String s = "         ";
		if (str.length() > length) {
			return str.substring(0, length);
		} else if (str.length() == length) {
			return str;
		} else {
			return s.substring(0, (int) (length - str.length()) / 2) + str
					+ s.substring(0, (int) (length - str.length()) / 2);
		}
	}
}
